export default {
    data() {
        return {
            searchData: {
                pageSize: 20,
                pageNumber: 1,
            },
            triggered: false, // 下拉刷新
            showEmpty: false,
            list: [],
            status: "loading",
        }
    },
    methods: {
        init() {
            this.searchData.pageNumber = 1;
            this.status = "loading";
            this.showEmpty = false;
            this.list = [];
        },
        /**
         * 上拉加载
         */
        onScrollToLower() {
            if (this.status === 'loading') {
            this.searchData.pageNumber++
            this.getData()
            }
        },
        onRefresh() {
            if (this.Isfreshing) return
            this.Isfreshing = true
            if (!this.triggered) {
            // 保证刷新状态下，triggered为true
            this.triggered = true
            this.init()
            this.getData()
            setTimeout(() => {
                this.triggered = false // 触发onRestore，关闭刷新图标
                this.Isfreshing = false
            }, 1200)
            }
        },
    }
}